<extend name="public:base"/>

<block name="left">
    <div class="mark_bar cl">
        <a href="{:url('uc/index/index')}" class="goback fl"><i class="iconfont">&#xe600;</i></a>
        <p><if condition="$is_bank eq 0">企业认证<else/>开通银行存管</if></p>
    </div>
</block>

<block name="main">
    <if condition="$Think.session.user_auth.user_type eq 1">

        <div class="container">
            <form action="{:url('uc/index/account')}" method="post" id="form">
                <if condition="$is_bank eq 1">
                    <div class="openBoscBank">
                        <i class="icon"></i>
                        <p>开通上海银行存管账户</p>
                    </div>
                </if>
                <div class="form">
                    <div class="input_form">
                        <div class="input_form_bar">
                            <p>持卡人姓名</p>
                            <input name="real_name" id="real_name" size="20" maxlength="11" type="text" autocomplete="off" placeholder="请输入本人真实姓名" value="{$user.real_name|default=''}" <if condition="$user.real_name neq ''">disabled</if> />
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar">
                            <p>身份证号</p>
                            <input name="idcard" id="idcard" class="input_t" value="{$user.idcard|default=''}" size="18" maxlength="18" autocomplete="off" type="text" placeholder="请输入身份证号" <if condition="$user.idcard neq ''">disabled</if> />
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar">
                            <p>银行卡号</p>
                            <input type="tel" name="card_id" id="card_id" size="19" maxlength="19" placeholder="请填写银行卡号(借记卡)" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                    </div>
                    <div class="top_tips"><i class="iconfont red">&#xe62a;</i>银行预留手机号必须与注册手机号一致！若不一致，会导致开户失败，如有任何问题请联系客服(<b class="red">400-064-8388</b>)</div>
                    <div class="wrap">
                        <input class="submit" type="submit" value="开户" />
                    </div>
                </div>
            </form>
        </div>

        <else/>

        <div class="container">
            <form action="{:url('uc/index/company_account')}" method="post" id="form">

                <div class="openBoscBank">
                    <i class="icon"></i>
                    <if condition="$user.audit_status eq 1">
                        <p>企业认证审核中</p>
                        <elseif condition="$user.audit_status eq 3"/>
                        <p>企业认证未通过，如需帮助请联系客服</p>
                        <else/>
                        <p>开通富邦华一银行存管账户</p>
                    </if>
                </div>

                <div class="form">
                    <div class="input_form">
                        <div class="input_form_bar">
                            <p>企业名称</p>
                            <input type="text" name="corp_name" id="companyName" value="{$user.enterprise_name}" class="input_t" placeholder="请输入企业名称" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar">
                            <p>营业执照类型</p>
                            <select class="select" onchange="change_license(this)" id="license">
                                <option value="0"  <empty name="$user.unified_code">selected</empty>>旧营业执照</option>
                                <option value="1" <notempty name="$user.unified_code">selected</notempty>>新营业执照</option>
                            </select>
                            <div class="cl"></div>
                        </div>
                        <!--旧营业执照-->
                        <div class="input_form_bar <notempty name="$user.unified_code">hide</notempty>" id="oldbusiness">
                            <p>营业执照编码</p>
                            <input type="text" name="trad_code" id="business" value="{$user.business_license}" class="input_t" placeholder="请输入营业执照编码" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar <notempty name="$user.unified_code">hide</notempty>" id="oldLicense">
                            <p>组织机构代码</p>
                            <input type="text" name="org_code" id="organization" value="{$user.org_no}" class="input_t" placeholder="请输入组织机构代码" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar <notempty name="$user.unified_code">hide</notempty>" id="oldTax">
                            <p>税务登记号</p>
                            <input type="text" name="tax_id" id="tax" value="{$user.tax_no}" class="input_t" placeholder="请输入税务登记号" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <!--新营业执照-->
                        <div class="input_form_bar <empty name="$user.unified_code">hide</empty>" id="newLicense">
                            <p class="double">统一社会信用代码</p>
                            <input type="text" name="unified_code" id="sociology" value="{$user.unified_code}" class="input_t" placeholder="请输入统一社会信用代码" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                    </div>
                    <div class="input_form margin">
                        <div class="input_form_bar">
                            <p>法人姓名</p>
                            <input type="text" name="legal" id="LegalName" value="{$user.legal}" class="input_t" placeholder="请输入法人姓名" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar">
                            <p>法人身份证号</p>
                            <input type="text" name="legal_cardno" id="legalRealName" value="{$user.legal_idcard}" class="input_t" placeholder="请输入身份证号" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar">
                            <p>企业联系人</p>
                            <input type="text" name="corp_contact" id="contacts" value="{$user.contact}" class="input_t" placeholder="请输入企业联系人" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar">
                            <p>联系人手机号</p>
                            <input type="text" name="telphone" id="contactsPhone" value="{$user.contact_phone}" class="input_t" placeholder="请输入联系人手机号" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar">
                            <p class="double">开户银行许可证核准号</p>
                            <input type="text" name="bank_license" id="bankLicense" value="{$user.bank_license}" class="input_t" placeholder="请输入开户银行许可证核准号" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar">
                            <p>银行卡号</p>
                            <input type="text" name="bank_card" id="publicAccount" value="{$user.card_id}" class="input_t" placeholder="请输入银行卡号" autocomplete="off"/>
                            <div class="cl"></div>
                        </div>
                        <div class="input_form_bar">
                            <p>开户行</p>
                            <select class="select" name="bank_code" id="bank_code">
                                <volist name="bank_list" id="v">
                                    <option value="{$v.bank_code}" <eq name="$user.bank_code" value="$v.bank_code">selected</eq>>{$v.bank_name}</option>
                                </volist>
                            </select>
                            <div class="cl"></div>
                        </div>

                    </div>
                    <div class="wrap">
                        <if condition="$is_bank eq 1">
                            <switch name="user.audit_status" >
                                <case value="0" break="1"><input class="submit" type="submit" value="开户" /></case>
                                <case value="1" break="1"><input class="submit disabled" type="submit" disabled value="银行审核中" /></case>
                            </switch>
                            <else/>
                            <switch name="user.audit_status" >
                                <case value="0" break="1"><input class="submit" type="submit" value="立即认证" /></case>
                                <case value="1" break="1"><input class="submit disabled" type="submit" disabled value="审核中" /></case>
                                <case value="2" break="1"><input class="submit disabled" type="submit" disabled value="审核通过" /></case>
                                <case value="3" break="1"><input class="submit disabled" type="submit" disabled value="认证失败" /></case>
                            </switch>
                        </if>
                    </div>
                </div>
            </form>

            <!--企业文件上传-->
            <if condition="$user.file_status eq 0 && $user.audit_status eq 1">
                <!--...请继续完成企业资料上传-->
                <form action="{:url('uc/index/file')}" method="POST" id="fileForm" enctype="multipart/form-data" <notempty name="user.unified_code">data-type="1"<else/>data-type="0"</notempty>>
                <label class="txt">文件类型<span class="check-tips">（文件大小：2MB, 文件类型：.jpg .png）</span></label>
                <div class="form-group">
                    <div class="picker-box">
                        <div id="upload_bankOpeningPermit" class="picker_button">上传银行开户许可证</div>
                        <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                            <input type="hidden" name="bankOpeningPermit" id="bankOpeningPermit" value="{$info.thumbnail_id}">
                            <else/>
                            <input type="hidden" name="bankOpeningPermit" id="bankOpeningPermit" value="">
                        </if>
                    </div>
                    <div id="fileList_picture_bank" class="upload-file-list-info clearfix">
                        <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                            <li class="affix-list-item" id="WU_FILE_SMALL_0">
                                <div class="upload-file-info">
                                    <span class="webuploader-pick-file-close" data-queued-id="WU_FILE_SMALL_0" data-id="{$info['thumbnail_id']|default=0}" data-fileurl="{$info['thumbnail']['path']|default=''}"><i class="close"></i></span>
                                    <span class="fname"></span>
                                    <span class="fsize">上传时间:{$info['thumbnail']['create_time']|date='Y-m-d H:i', ###}</span>
                                    <div class="clearfix"></div>
                                </div>
                                <div class="filebox image">
                                    <img src="{$info['thumbnail']['path']|default=''}" class="img-responsive">
                                </div>
                            </li>
                        </if>
                    </div>
                </div>

                <script type="text/javascript">

                    $(function () {

                        $("#upload_bankOpeningPermit").SentUploader({
                            server: "{:url('upload/upload?flash=1&source=company')}" ,
                            delUrl:"{:url('upload/del')}",
                            uploadEvents: {
                                uploadComplete:function(file){}
                            },
                            listName : 'fileList_picture_bank',
                            hiddenName: 'bankOpeningPermit',
                            hiddenValType:1,
                            fileNumLimit:1,
                            fileSingleSizeLimit:500 * 1024,
                            closeX:true
                        }, {
                            fileType: 'service',
                            filename : 'images'
                        });

                    })
                </script>
                <notempty name="user.unified_code">
                    <div class="form-group">
                        <div class="picker-box">
                            <div id="upload_threeCardsTogether" class="picker_button">上传三证合一新营业执照</div>
                            <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                                <input type="hidden" name="threeCardsTogether" id="threeCardsTogether" value="{$info.thumbnail_id}">
                                <else/>
                                <input type="hidden" name="threeCardsTogether" id="threeCardsTogether" value="">
                            </if>
                        </div>

                        <div id="fileList_picture_cards" class="upload-file-list-info clearfix">
                            <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                                <li class="affix-list-item" id="WU_FILE_SMALL_1">
                                    <div class="upload-file-info">
                                        <span class="webuploader-pick-file-close" data-queued-id="WU_FILE_SMALL_1" data-id="{$info['thumbnail_id']|default=0}" data-fileurl="{$info['thumbnail']['path']|default=''}"><i class="close"></i></span>
                                        <span class="fname"></span>
                                        <span class="fsize">上传时间:{$info['thumbnail']['create_time']|date='Y-m-d H:i', ###}</span>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="filebox image">
                                        <img src="{$info['thumbnail']['path']|default=''}" class="img-responsive">
                                    </div>
                                </li>
                            </if>
                        </div>
                    </div>
                    <script type="text/javascript">
                        $(function () {

                            $("#upload_threeCardsTogether").SentUploader({
                                server: "{:url('upload/upload?flash=1&source=company')}" ,
                                delUrl:"{:url('upload/del')}",
                                uploadEvents: {
                                    uploadComplete:function(file){}
                                },
                                listName : 'fileList_picture_cards',
                                hiddenName: 'threeCardsTogether',
                                hiddenValType:1,
                                fileNumLimit:1,
                                fileSingleSizeLimit:500 * 1024,
                                closeX:true
                            }, {
                                fileType: 'service',
                                filename : 'images'
                            });

                        })
                    </script>
                </notempty>

                <empty name="user.unified_code">
                    <div class="form-group">
                        <div class="picker-box">
                            <div id="upload_businessLicense" class="picker_button">上传普通营业执照</div>
                            <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                                <input type="hidden" name="businessLicense" id="businessLicense" value="{$info.thumbnail_id}">
                                <else/>
                                <input type="hidden" name="businessLicense" id="businessLicense" value="">
                            </if>
                        </div>

                        <div id="fileList_picture_license" class="upload-file-list-info clearfix">
                            <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                                <li class="affix-list-item" id="WU_FILE_SMALL_2">
                                    <div class="upload-file-info">
                                        <span class="webuploader-pick-file-close" data-queued-id="WU_FILE_SMALL_2" data-id="{$info['thumbnail_id']|default=0}" data-fileurl="{$info['thumbnail']['path']|default=''}"><i class="close"></i></span>
                                        <span class="fname"></span>
                                        <span class="fsize">上传时间:{$info['thumbnail']['create_time']|date='Y-m-d H:i', ###}</span>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="filebox image">
                                        <img src="{$info['thumbnail']['path']|default=''}" class="img-responsive">
                                    </div>
                                </li>
                            </if>
                        </div>
                    </div>
                    <script type="text/javascript">

                        $(function () {

                            $("#upload_businessLicense").SentUploader({
                                    server: "{:url('upload/upload?flash=1&source=company')}" ,
                                    delUrl:"{:url('upload/del')}",
                                    uploadEvents: {
                                        uploadComplete:function(file){

                                        }
                                    },

                                    listName : 'fileList_picture_license',
                                    hiddenName: 'businessLicense',
                                    hiddenValType:1,
                                    fileNumLimit:1,
                                    fileSingleSizeLimit:500 * 1024,
                                    closeX:true
                                },
                                {
                                    fileType: 'service',
                                    filename : 'images'
                                });

                        })

                    </script>
                    <div class="form-group">
                        <div class="picker-box">
                            <div id="upload_taxRegistration" class="picker_button">上传税务登记证</div>
                            <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                                <input type="hidden" name="taxRegistration" id="taxRegistration" value="{$info.thumbnail_id}">
                                <else/>
                                <input type="hidden" name="taxRegistration" id="taxRegistration" value="">
                            </if>
                        </div>
                        <div id="fileList_picture_tax" class="upload-file-list-info clearfix">
                            <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                                <li class="affix-list-item" id="WU_FILE_SMALL_3">
                                    <div class="upload-file-info">
                                        <span class="webuploader-pick-file-close" data-queued-id="WU_FILE_SMALL_3" data-id="{$info['thumbnail_id']|default=0}" data-fileurl="{$info['thumbnail']['path']|default=''}"><i class="close"></i></span>
                                        <span class="fname"></span>
                                        <span class="fsize">上传时间:{$info['thumbnail']['create_time']|date='Y-m-d H:i', ###}</span>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="filebox image">
                                        <img src="{$info['thumbnail']['path']|default=''}" class="img-responsive">
                                    </div>
                                </li>
                            </if>
                        </div>
                    </div>
                    <script type="text/javascript">

                        $(function () {

                            $("#upload_taxRegistration").SentUploader({
                                server: "{:url('upload/upload?flash=1&source=company')}" ,
                                delUrl:"{:url('upload/del')}",
                                uploadEvents: {
                                    uploadComplete:function(file){}
                                },

                                listName : 'fileList_picture_tax',
                                hiddenName: 'taxRegistration',
                                hiddenValType:1,
                                fileNumLimit:1,
                                fileSingleSizeLimit:500 * 1024,
                                closeX:true
                            }, {
                                fileType: 'service',
                                filename : 'images'
                            });

                        })

                    </script>
                    <div class="form-group">
                        <div class="picker-box">
                            <div id="upload_orgCode" class="picker_button">上传组织机构代码证</div>
                            <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                                <input type="hidden" name="orgCode" id="orgCode" value="{$info.thumbnail_id}">
                                <else/>
                                <input type="hidden" name="orgCode" id="orgCode" value="">
                            </if>
                        </div>

                        <div id="fileList_picture_code" class="upload-file-list-info clearfix">
                            <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                                <li class="affix-list-item" id="WU_FILE_SMALL_4">
                                    <div class="upload-file-info">
                                        <span class="webuploader-pick-file-close" data-queued-id="WU_FILE_SMALL_4" data-id="{$info['thumbnail_id']|default=0}" data-fileurl="{$info['thumbnail']['path']|default=''}"><i class="close"></i></span>
                                        <span class="fname"></span>
                                        <span class="fsize">上传时间:{$info['thumbnail']['create_time']|date='Y-m-d H:i', ###}</span>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="filebox image">
                                        <img src="{$info['thumbnail']['path']|default=''}" class="img-responsive">
                                    </div>
                                </li>
                            </if>
                        </div>
                    </div>
                    <script type="text/javascript">

                        $(function () {

                            $("#upload_orgCode").SentUploader({
                                    server: "{:url('upload/upload?flash=1&source=company')}" ,
                                    delUrl:"{:url('upload/del')}",
                                    uploadEvents: {
                                        uploadComplete:function(file){}
                                    },

                                    listName : 'fileList_picture_code',
                                    hiddenName: 'orgCode',
                                    hiddenValType:1,
                                    fileNumLimit:1,
                                    fileSingleSizeLimit:500 * 1024,
                                    closeX:true
                                },
                                {
                                    fileType: 'service',
                                    filename : 'images'
                                });

                        })

                    </script>
                </empty>
                <div class="form-group">
                    <div class="picker-box">
                        <div id="upload_iDCardFacade" class="picker_button">上传法人身份证正面照</div>
                        <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                            <input type="hidden" name="iDCardFacade" id="iDCardFacade" value="{$info.thumbnail_id}">
                            <else/>
                            <input type="hidden" name="iDCardFacade" id="iDCardFacade" value="">
                        </if>
                    </div>

                    <div id="fileList_picture_idcarda" class="upload-file-list-info clearfix">
                        <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                            <li class="affix-list-item" id="WU_FILE_SMALL_5">
                                <div class="upload-file-info">
                                    <span class="webuploader-pick-file-close" data-queued-id="WU_FILE_SMALL_5" data-id="{$info['thumbnail_id']|default=0}" data-fileurl="{$info['thumbnail']['path']|default=''}"><i class="close"></i></span>
                                    <span class="fname"></span>
                                    <span class="fsize">上传时间:{$info['thumbnail']['create_time']|date='Y-m-d H:i', ###}</span>
                                    <div class="clearfix"></div>
                                </div>
                                <div class="filebox image">
                                    <img src="{$info['thumbnail']['path']|default=''}" class="img-responsive">
                                </div>
                            </li>
                        </if>
                    </div>
                </div>

                <script type="text/javascript">

                    $(function () {

                        $("#upload_iDCardFacade").SentUploader({
                                server: "{:url('upload/upload?flash=1&source=company')}" ,
                                delUrl:"{:url('upload/del')}",
                                uploadEvents: {
                                    uploadComplete:function(file){}
                                },

                                listName : 'fileList_picture_idcarda',
                                hiddenName: 'iDCardFacade',
                                hiddenValType:1,
                                fileNumLimit:1,
                                fileSingleSizeLimit:500 * 1024,
                                closeX:true
                            },
                            {
                                fileType: 'service',
                                filename : 'images'
                            });

                    })

                </script>
                <!--<notempty name="$user.unified_code">style=" margin-left:300px; border-right:0;"</notempty>-->
                <div class="form-group">
                    <div class="picker-box">
                        <div id="upload_iDCardBack" class="picker_button">上传法人身份证反面照</div>
                        <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                            <input type="hidden" name="iDCardBack" id="iDCardBack" value="{$info.thumbnail_id}">
                            <else/>
                            <input type="hidden" name="iDCardBack" id="iDCardBack" value="">
                        </if>
                    </div>

                    <div id="fileList_picture_idcardb" class="upload-file-list-info clearfix">
                        <if condition="isset($info['thumbnail_id']) and $info['thumbnail_id'] gt 0">
                            <li class="affix-list-item" id="WU_FILE_SMALL_6">
                                <div class="upload-file-info">
                                    <span class="webuploader-pick-file-close" data-queued-id="WU_FILE_SMALL_6" data-id="{$info['thumbnail_id']|default=0}" data-fileurl="{$info['thumbnail']['path']|default=''}"><i class="close"></i></span>
                                    <span class="fname"></span>
                                    <span class="fsize">上传时间:{$info['thumbnail']['create_time']|date='Y-m-d H:i', ###}</span>
                                    <div class="clearfix"></div>
                                </div>
                                <div class="filebox image">
                                    <img src="{$info['thumbnail']['path']|default=''}" class="img-responsive">
                                </div>
                            </li>
                        </if>
                    </div>
                </div>
                <script type="text/javascript">

                    $(function () {

                        $("#upload_iDCardBack").SentUploader({
                            server: "{:url('upload/upload?flash=1&source=company')}" ,
                            delUrl:"{:url('upload/del')}",
                            uploadEvents: {
                                uploadComplete:function(file){}
                            },
                            listName : 'fileList_picture_idcardb',
                            hiddenName: 'iDCardBack',
                            hiddenValType:1,
                            fileNumLimit:1,
                            fileSingleSizeLimit:500 * 1024,
                            closeX:true
                        }, {
                            fileType: 'service',
                            filename : 'images'
                        });

                    })

                </script>
                <div class="clear"></div>
                <div class="wrap">
                    <input class="submit" type="submit" value="立即提交" />
                </div>
                </form>
            </if>
        </div>

    </if>

</block>

<block name="menu"></block>

<block name="css">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/js/webuploader/webuploader.css">

    <style type="text/css">
        #fileForm{ wdith:20rem; background: #fff; padding: 1rem;}
        #fileForm .txt{ font-size: 0.75rem; color: #999; height: 2rem; line-height: 2rem;}
        #fileForm .wrap{padding: 1rem 0;}
        #fileForm .webuploader-pick-file-close{position: relative;}
        #fileForm .webuploader-pick-file-close i.close{position: static;}
        #fileForm .upload-file-list-info .affix-list-item{ max-width: 100%;}
    </style>
</block>

<block name="js">

    <script type="text/javascript" src="__JS__/check.js?v={:config('app_ver')}"></script>
    <if condition="session('user_auth.user_type') eq 1">

        <script type="text/javascript">
            $('#form').submit(function() {
                if(!checkRealname()) return false;
                if(!checkIdcard()) return false;
                if (!checkBankcard()) return false;
            });
        </script>

        <else/>

        <!--省市区选择JS-->
     <!--   <link href="__JS__/area/dialog.css" type="text/css" rel="stylesheet" />
        <link href="__JS__/area/mobile-select-area.css" type="text/css" rel="stylesheet" />
        <script type="text/javascript" src="__PUBLIC__/js/area.js"></script>
        <script type="text/javascript" src="__JS__/area/dialog.js"></script>
        <script type="text/javascript" src="__JS__/area/mobile-select-area.js"></script>-->
        <script>var BASE_URL = '';</script>
        <script type="text/javascript" src="__PUBLIC__/js/webuploader/webuploader.min.js"></script>
        <script type="text/javascript" src="__PUBLIC__/js/webuploader/webuploader.custom.wap.js"></script>
        <script type="text/javascript">



            function hide_input(id) {
                $(id).addClass("hide").find("input").prop("disabled",true);
            }
            function show_input(id) {
                $(id).removeClass("hide").find("input").prop("disabled",false);
            }
            function change_license(e) {
                var val = parseInt($(e).val());
                if(val === 0){
                    show_input("#oldLicense");
                    show_input("#oldbusiness");
                    show_input("#oldTax");
                    hide_input("#newLicense");
                }else{
                    hide_input("#oldLicense");
                    hide_input("#oldbusiness");
                    hide_input("#oldTax");
                    show_input("#newLicense");
                }
            }

            $('#form').submit(function() {

                // 企业名字
                var cm = $("#companyName");
                if (cm.val().length <= 0) {
                    wjtips("请输入企业名称");
                    return false;
                }

                // 组织机构代码
                var license = parseInt($("#license").val());
                if(license === 0){
                    // 营业执照编码
                    var business = $("#business");
                    if (!stringReg.test($(business).val())) {
                        wjtips("请输入正确的营业执照编码！");
                        return false;
                    }

                    // 组织机构代码
                    var organization = $("#organization");
                    if (!stringReg.test($(organization).val())) {
                        wjtips("请输入正确的组织机构代码！");
                        return false;
                    }
                    // 税务登记号
                    var tax = $("#tax");
                    if (!stringReg.test($(tax).val())) {
                        wjtips("请输入正确的税务登记号！");
                        return false;
                    }
                }else{
                    // 统一社会信用代码
                    var sociology = $("#sociology");
                    if (!stringReg.test($(sociology).val())) {
                        wjtips("请输入正确的统一社会信用代码！");
                        return false;
                    }
                }
                
                /*
                // 机构信用代码
                var mechanism = $("#mechanism");
                if (!stringReg.test($(mechanism).val())) {
                    wjtips("请输入正确的税务登记号！");
                    return false;
                }
                */

                // 法人姓名
                var legalname = $("#LegalName");
                var m0 = legalname.val().match(/^[\u4e00-\u9fa5]{2,20}$/i);  //中文名字2-20位
                if (legalname.length === 0 || !m0) {
                    wjtips("请输入法人姓名");
                    return false;
                }

                // 法人身份证号
                var legalRealName = $("#legalRealName");
                if (!isIdCard1.test($(legalRealName).val()) && !isIdCard2.test($(legalRealName).val())) {
                    wjtips("请输入正确的身份证号");
                    return false;
                }

                // 企业联系人
                var contacts = $("#contacts");
                var m2 = contacts.val().match(/^[\u4e00-\u9fa5]{2,20}$/i);  //中文名字2-20位
                if (contacts.length === 0 || !m2) {
                    wjtips("请输入企业联系人");
                    return false;
                }

                // 联系人手机号
                var contactsPhone = $("#contactsPhone");
                if (!regex.test($(contactsPhone).val())) {
                    wjtips("请输入联系人手机号");
                    return false;
                }

                // 开户银行许可证核准号
                var bankLicense = $("#bankLicense");
                if (!stringReg.test($(bankLicense).val())) {
                    wjtips("请输入开户银行许可证核准号");
                    return false;
                }

                // 企业对公账号
                var publicAccount = $("#publicAccount");
                if (!minSexNumber.test($(publicAccount).val())){
                    wjtips("企业对公账号格式错误,请检查位数是否正确");
                    return false;
                }

                if( is_bank === 0){
                    return ajax_post($(this));
                }
            });

            $("#fileForm").submit(function () {
                // 上传银行开户许可证
                var bank1 = $("#bankOpeningPermit").val();
                if(!bank1){
                    wjtips("请上传上传银行开户许可证！");
                    return false;
                }

                if($(this).attr("data-type") == 1){
                    // 上传三证合一新营业执照
                    var threeCards = $("#threeCardsTogether").val();
                    if(!threeCards){
                        wjtips("请上传三证合一新营业执照！");
                        return false;
                    }
                }else{
                    // 上传普通营业执照
                    var business = $("#businessLicense").val();
                    if(!business){
                        wjtips("请上传普通营业执照！");
                        return false;
                    }

                    // 上传税务登记证
                    var taxRegistration = $("#taxRegistration").val();
                    if(!taxRegistration){
                        wjtips("请上传税务登记证！");
                        return false;
                    }

                    // 上传组织机构代码证
                    var orgCode = $("#orgCode").val();
                    if(!orgCode){
                        wjtips("请上传组织机构代码证！");
                        return false;
                    }
                }

                // 上传法人身份证正面照
                var idcard1 = $("#iDCardFacade").val();
                if(!idcard1){
                    wjtips("请上传法人身份证正面照！");
                    return false;
                }

                // 上传法人身份证反面照
                var idcard2 = $("#iDCardBack").val();
                if(!idcard2){
                    layer.alert("请上传法人身份证反面照！");
                    return false;
                }
                
                return ajax_post($(this));
            })
        </script>

    </if>
</block>


